.class public Lcom/bitauto/autoeasy/selectcar/PromotionActivity;
.super Lcom/bitauto/autoeasy/BaseListActivity;
.source "PromotionActivity.java"

# interfaces
.implements Landroid/view/View$OnClickListener;
.implements Landroid/widget/AdapterView$OnItemClickListener;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/bitauto/autoeasy/selectcar/PromotionActivity$downLoadTask;
    }
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Lcom/bitauto/autoeasy/BaseListActivity;",
        "Landroid/view/View$OnClickListener;",
        "Landroid/widget/AdapterView$OnItemClickListener;"
    }
.end annotation


# instance fields
.field private final TAG:Ljava/lang/String;

.field private list:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/news/Object/Promotion;",
            ">;"
        }
    .end annotation
.end field

.field private listView:Landroid/widget/ListView;

.field public progressBar:Landroid/widget/ProgressBar;

.field private promotionAdapter:Lcom/bitauto/autoeasy/selectcar/Adapter/PromotionAdapter;

.field promotionParser:Lcom/bitauto/autoeasy/news/Object/PromotionParser;

.field private url:Ljava/lang/String;


# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    .line 30
    invoke-direct {p0}, Lcom/bitauto/autoeasy/BaseListActivity;-><init>()V

    .line 34
    const-string v0, ""

    iput-object v0, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->url:Ljava/lang/String;

    .line 39
    const-string v0, "PromotionActivity"

    iput-object v0, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->TAG:Ljava/lang/String;

    .line 30
    return-void
.end method


# virtual methods
.method public downLoadData()V
    .locals 1

    .prologue
    .line 55
    iget-object v0, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->promotionParser:Lcom/bitauto/autoeasy/news/Object/PromotionParser;

    invoke-virtual {v0}, Lcom/bitauto/autoeasy/news/Object/PromotionParser;->Paser2Object()Ljava/util/ArrayList;

    move-result-object v0

    iput-object v0, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->list:Ljava/util/ArrayList;

    .line 57
    return-void
.end method

.method public getList(Ljava/lang/String;)Ljava/util/ArrayList;
    .locals 2
    .parameter "url"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/String;",
            ")",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/news/Object/Promotion;",
            ">;"
        }
    .end annotation

    .prologue
    .line 85
    iget-object v0, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->promotionParser:Lcom/bitauto/autoeasy/news/Object/PromotionParser;

    invoke-static {p1}, Lcom/bitauto/autoeasy/tool/ToolBox;->changeSpace(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/bitauto/autoeasy/news/Object/PromotionParser;->setUrl(Ljava/lang/String;)V

    .line 86
    iget-object v0, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->promotionParser:Lcom/bitauto/autoeasy/news/Object/PromotionParser;

    invoke-virtual {v0}, Lcom/bitauto/autoeasy/news/Object/PromotionParser;->Paser2Object()Ljava/util/ArrayList;

    move-result-object v0

    return-object v0
.end method

.method public initView()V
    .locals 1

    .prologue
    .line 69
    invoke-virtual {p0}, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->getListView()Landroid/widget/ListView;

    move-result-object v0

    iput-object v0, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->listView:Landroid/widget/ListView;

    .line 70
    iget-object v0, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->listView:Landroid/widget/ListView;

    invoke-virtual {v0, p0}, Landroid/widget/ListView;->setOnItemClickListener(Landroid/widget/AdapterView$OnItemClickListener;)V

    .line 77
    return-void
.end method

.method public onClick(Landroid/view/View;)V
    .locals 6
    .parameter "v"

    .prologue
    const/4 v5, 0x1

    .line 103
    invoke-virtual {p1}, Landroid/view/View;->getId()I

    move-result v2

    packed-switch v2, :pswitch_data_0

    .line 112
    :goto_0
    return-void

    .line 106
    :pswitch_0
    new-instance v2, Ljava/lang/StringBuilder;

    iget-object v3, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->url:Ljava/lang/String;

    invoke-static {v3}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v3, "&time="

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    iget-object v2, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->list:Ljava/util/ArrayList;

    iget-object v4, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->list:Ljava/util/ArrayList;

    invoke-virtual {v4}, Ljava/util/ArrayList;->size()I

    move-result v4

    sub-int/2addr v4, v5

    invoke-virtual {v2, v4}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/bitauto/autoeasy/news/Object/Promotion;

    invoke-virtual {v2}, Lcom/bitauto/autoeasy/news/Object/Promotion;->getPublishTime()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v3, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    .line 107
    .local v0, temp:Ljava/lang/String;
    const-string v2, "PromotionActivity"

    invoke-static {v2, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 108
    new-instance v1, Lcom/bitauto/autoeasy/selectcar/PromotionUpdateTask;

    invoke-direct {v1, p0, v0}, Lcom/bitauto/autoeasy/selectcar/PromotionUpdateTask;-><init>(Lcom/bitauto/autoeasy/selectcar/PromotionActivity;Ljava/lang/String;)V

    .line 109
    .local v1, updateTask:Lcom/bitauto/autoeasy/selectcar/PromotionUpdateTask;
    new-array v2, v5, [Ljava/lang/String;

    const/4 v3, 0x0

    const-string v4, ""

    aput-object v4, v2, v3

    invoke-virtual {v1, v2}, Lcom/bitauto/autoeasy/selectcar/PromotionUpdateTask;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask;

    goto :goto_0

    .line 103
    :pswitch_data_0
    .packed-switch 0x7f0b0015
        :pswitch_0
    .end packed-switch
.end method

.method protected onCreate(Landroid/os/Bundle;)V
    .locals 6
    .parameter "savedInstanceState"

    .prologue
    const/4 v5, 0x1

    const/4 v4, 0x0

    .line 43
    const v0, 0x7f03002a

    invoke-virtual {p0, v0}, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->setContentView(I)V

    .line 44
    new-instance v0, Ljava/lang/StringBuilder;

    const-string v1, "http://m.bitauto.com/appapi/Preferential/List.ashx?serialid="

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {p0}, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->getIntent()Landroid/content/Intent;

    move-result-object v1

    const-string v2, "carid"

    invoke-virtual {v1, v2, v4}, Landroid/content/Intent;->getIntExtra(Ljava/lang/String;I)I

    move-result v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    .line 45
    const-string v1, "&cityid="

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, "autoeasy"

    invoke-virtual {p0, v1, v5}, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v1

    const-string v2, "cityid"

    const-string v3, "201"

    invoke-interface {v1, v2, v3}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    .line 44
    iput-object v0, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->url:Ljava/lang/String;

    .line 46
    new-instance v0, Lcom/bitauto/autoeasy/news/Object/PromotionParser;

    iget-object v1, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->url:Ljava/lang/String;

    invoke-direct {v0, v1}, Lcom/bitauto/autoeasy/news/Object/PromotionParser;-><init>(Ljava/lang/String;)V

    iput-object v0, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->promotionParser:Lcom/bitauto/autoeasy/news/Object/PromotionParser;

    .line 48
    invoke-virtual {p0}, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->initView()V

    .line 49
    new-instance v0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity$downLoadTask;

    invoke-direct {v0, p0}, Lcom/bitauto/autoeasy/selectcar/PromotionActivity$downLoadTask;-><init>(Lcom/bitauto/autoeasy/selectcar/PromotionActivity;)V

    new-array v1, v5, [Ljava/lang/String;

    const-string v2, ""

    aput-object v2, v1, v4

    invoke-virtual {v0, v1}, Lcom/bitauto/autoeasy/selectcar/PromotionActivity$downLoadTask;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask;

    .line 51
    invoke-super {p0, p1}, Lcom/bitauto/autoeasy/BaseListActivity;->onCreate(Landroid/os/Bundle;)V

    .line 52
    return-void
.end method

.method public onItemClick(Landroid/widget/AdapterView;Landroid/view/View;IJ)V
    .locals 4
    .parameter
    .parameter "view"
    .parameter "position"
    .parameter "id"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/widget/AdapterView",
            "<*>;",
            "Landroid/view/View;",
            "IJ)V"
        }
    .end annotation

    .prologue
    .local p1, parent:Landroid/widget/AdapterView;,"Landroid/widget/AdapterView<*>;"
    const-string v3, "title"

    .line 117
    new-instance v0, Landroid/content/Intent;

    const-class v1, Lcom/bitauto/autoeasy/selectcar/PromotionDetailActivity;

    invoke-direct {v0, p0, v1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 118
    .local v0, intent:Landroid/content/Intent;
    const-string v2, "newsid"

    iget-object v1, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->list:Ljava/util/ArrayList;

    invoke-virtual {v1, p3}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/bitauto/autoeasy/news/Object/Promotion;

    invoke-virtual {v1}, Lcom/bitauto/autoeasy/news/Object/Promotion;->getID()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v2, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 119
    const-string v1, "title"

    invoke-virtual {p0}, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->getIntent()Landroid/content/Intent;

    move-result-object v1

    const-string v2, "title"

    invoke-virtual {v1, v3}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v3, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 120
    const-string v2, "title1"

    iget-object v1, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->list:Ljava/util/ArrayList;

    invoke-virtual {v1, p3}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/bitauto/autoeasy/news/Object/Promotion;

    invoke-virtual {v1}, Lcom/bitauto/autoeasy/news/Object/Promotion;->getTitle()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v2, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 121
    const-string v2, "date"

    iget-object v1, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->list:Ljava/util/ArrayList;

    invoke-virtual {v1, p3}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/bitauto/autoeasy/news/Object/Promotion;

    invoke-virtual {v1}, Lcom/bitauto/autoeasy/news/Object/Promotion;->getPublishTime()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v2, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 122
    invoke-virtual {p0, v0}, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->startActivity(Landroid/content/Intent;)V

    .line 123
    return-void
.end method

.method public refreshView()V
    .locals 3

    .prologue
    .line 60
    new-instance v0, Lcom/bitauto/autoeasy/selectcar/Adapter/PromotionAdapter;

    iget-object v1, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->list:Ljava/util/ArrayList;

    iget-object v2, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->listView:Landroid/widget/ListView;

    invoke-direct {v0, v1, p0, v2}, Lcom/bitauto/autoeasy/selectcar/Adapter/PromotionAdapter;-><init>(Ljava/util/ArrayList;Landroid/content/Context;Landroid/widget/ListView;)V

    iput-object v0, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->promotionAdapter:Lcom/bitauto/autoeasy/selectcar/Adapter/PromotionAdapter;

    .line 61
    iget-object v0, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->list:Ljava/util/ArrayList;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->list:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->size()I

    move-result v0

    if-lez v0, :cond_0

    .line 62
    iget-object v0, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->listView:Landroid/widget/ListView;

    iget-object v1, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->promotionAdapter:Lcom/bitauto/autoeasy/selectcar/Adapter/PromotionAdapter;

    invoke-virtual {v0, v1}, Landroid/widget/ListView;->setAdapter(Landroid/widget/ListAdapter;)V

    .line 66
    :cond_0
    return-void
.end method

.method public updateList(Ljava/util/ArrayList;)V
    .locals 3
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/news/Object/Promotion;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 93
    .local p1, list2:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/news/Object/Promotion;>;"
    const/4 v0, 0x0

    .local v0, i:I
    :goto_0
    invoke-virtual {p1}, Ljava/util/ArrayList;->size()I

    move-result v1

    if-lt v0, v1, :cond_1

    .line 96
    iget-object v1, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->promotionAdapter:Lcom/bitauto/autoeasy/selectcar/Adapter/PromotionAdapter;

    if-eqz v1, :cond_0

    .line 97
    iget-object v1, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->promotionAdapter:Lcom/bitauto/autoeasy/selectcar/Adapter/PromotionAdapter;

    invoke-virtual {v1}, Lcom/bitauto/autoeasy/selectcar/Adapter/PromotionAdapter;->notifyDataSetChanged()V

    .line 99
    :cond_0
    return-void

    .line 94
    :cond_1
    iget-object v2, p0, Lcom/bitauto/autoeasy/selectcar/PromotionActivity;->list:Ljava/util/ArrayList;

    invoke-virtual {p1, v0}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/bitauto/autoeasy/news/Object/Promotion;

    invoke-virtual {v2, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 93
    add-int/lit8 v0, v0, 0x1

    goto :goto_0
.end method
